#pragma once

#ifdef DatabaseIO_EXPORTS
#define DatabaseIO_API __declspec(dllexport)
#else
#define DatabaseIO_API __declspec(dllimport)
#endif

#include "sqlite3.h"
#include <string>
using namespace std;

enum OUT_STATUS
{
	OS_ALL_OUT = 0,
	OS_PART_OUT = 1
};
struct TRADE_DETAIL
{
	TRADE_DETAIL()
	{
		dInPrice = 0;
		iInVolume = 0;
		iDirect = 0;
		dOutPrice = 0;
		iOutVolumeTraded = 0;
		iOutVolumeRemain = 0;
	}
	string			strName;
	string			strInDate;
	string			strInTime;
	double			dInPrice;
	int				iInVolume;
	int				iDirect;
	string			strOutDate;
	string			strOutTime;
	double			dOutPrice;
	int				iOutVolumeTraded;
	int				iOutVolumeRemain;
};

//"create table TradeLog( StratName text,InDate nvarchar(16), InTime nvarchar(16), InPrice real, InVolumeTraded integer, \
//			Direct integer, OutDate nvarchar(16), OutTime nvarchar(16), OutPrice real, OutVolumeTraded integer, MaxProfit real, MaxLoss real )"

class DatabaseIO_API CQuickIO
{
public:
	CQuickIO(void);
	~CQuickIO(void);

private:
	void						InitLocals();
private:
	sqlite3*					m_pTradeLog;
	string						m_strTradeLog;

public:
	bool						InitTradeLog();
	bool						InsertTradeRec();
	bool						UpdateTradeRec();
};
